﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.Reflection;
using Pixysoft.Weblications.Sango.Protocol.stage;
using Pixysoft.Weblications.Sango.Environment;
using Pixysoft.Weblications.Sango.Protocol;
using Pixysoft.Weblications.Sango.Battle;
using Pixysoft.Weblications.Sango.Protocol.section;

namespace Pixysoft.Weblications.Sango.Command.stage_rve
{
    partial class SangoStageRveHandler
    {
        public stagerve_teamlist stagerve_teamlist(long roomcode)
        {
            string userCode = SangoManager.Authentication();
            stagerve_teamlist response = ReflectionManager.CreatePojo<stagerve_teamlist>();

            RveStageTeam team = RveStageController.Instance.TryGetStageTeam(roomcode);
            if (team == null)
            {
                response.Message = "队伍不存在";
                return response;
            }

            response.stage = StageFacade.ToRveStage(team.Stage);

            response.profiles = UsrSectionFacade.ToProfilesByRveStage(team);
            response.creator = UsrSectionFacade.ToProfileByProfile(team.Creator);
            response.iscreator = userCode.Equals(team.Creator.Usercode, StringComparison.OrdinalIgnoreCase);
            response.Succeed = true;
            return response;
        }
    }

    public interface stagerve_teamlist : ISangoResponse
    {
        section_profile creator { get;set;}
        List<section_profile> profiles { get;set;}
        stage_rvestage stage { get;set;}
        bool iscreator { get;set;}
    }
}
